<template>
	<view class="content">
		<view class="uniFlex2">
			<view class="title">患者姓名：</view>
			<view class="msg">{{list.name}}</view>
		</view>
		<view class="uniFlex2">
			<view class="title">价格：</view>
			<view class="msg">{{list.price}}</view>
		</view>
		<view class="uniFlex2">
			<view class="title">付款类型：</view>
			<view class="msg uniFlex">
				<view class="uniFlex" @click="type=0">
					<img v-if="type==0" src="../../static/bg/wzf/a6.png" alt="">
					<img v-else src="../../static/bg/wzf/a5.png" alt="">
					<view>账户余额</view>
				</view>
				<view style="width: 50upx;"></view>
				<view class="uniFlex" @click="type=1">
					<img v-if="type==1" src="../../static/bg/wzf/a6.png" alt="">
					<img v-else src="../../static/bg/wzf/a5.png" alt="">
					<view>现金</view>
				</view>
			</view>
		</view>
		<view class="uniFlex2">
			<view class="title">账号余额：</view>
			<view class="msg">{{userprice}}</view>
		</view>
		<view class="uniFlex2">
			<view class="title">备注：</view>
			<view class="msg">{{list.remark}}</view>
		</view>
		
		<view class="btnStyle" @click="submit">确定</view>
	</view>
</template>

<script>
	import {
		wzfpay,wzfsf
	} from '@/request/api.js'
	export default {
		data() {
			return {
				id:'',
				type:0,
				userprice:0,
				list: {}
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.getDetail(option.id);
		},
		methods: {
			// 列表
			getDetail(id) {
				wzfpay({
					id:id
				}).then(res => {
					this.list = res.data.data;
					if(res.data.userprice){
						this.userprice = res.data.userprice;
					}
				})
			},
			submit(){
				let param = {
					id:this.id,
					status:1,
					pay_type:this.type
				}
				uni.showLoading({
					mask:true
				})
				wzfsf(param).then(res => {
					uni.hideLoading()
					uni.showToast({
						title:'操作成功',
						icon:'none'
					})
					setTimeout(function(){
						uni.reLaunch({
							url:'/pages/outside/outsideList'
						})
					},800)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		font-size: 28upx;
		color: #000;
		
		.uniFlex2{
			border-bottom: 1px solid #F8F8F8;
			padding: 30upx 0;
			margin: 0 30upx;
			
			.title{
				width: 160upx;
			}
			
			.msg{
				flex: 1;
				
				img{
					width: 33upx;
					height: 33upx;
					margin: 0 15upx;
				}
			}
		}
		.btnStyle{
			margin-top: 70upx;
		}
	}
</style>
